import request from '@/config/axios'

export interface GoodsVO {
  id: number
  supplyId: number
  brand: string
  status: byte
  sort: number
  updateTime: Date
  creator: string
  updater: string
  name: string
  pics: string
  sku: string
}

// 查询产品管理列表
export const getGoodsPage = async (params) => {
  return await request.get({ url: `/cms/goods/page`, params })
}

// 查询产品管理详情
export const getGoods = async (id: number) => {
  return await request.get({ url: `/cms/goods/get?id=` + id })
}

// 新增产品管理
export const createGoods = async (data: GoodsVO) => {
  return await request.post({ url: `/cms/goods/create`, data })
}

// 修改产品管理
export const updateGoods = async (data: GoodsVO) => {
  return await request.put({ url: `/cms/goods/update`, data })
}

// 删除产品管理
export const deleteGoods = async (id: number) => {
  return await request.delete({ url: `/cms/goods/delete?id=` + id })
}

// 导出产品管理 Excel
export const exportGoods = async (params) => {
  return await request.download({ url: `/cms/goods/export-excel`, params })
}
